// 修改导入方式
import { useToast } from 'radix-vue'

type ToastType = 'default' | 'success' | 'warning' | 'error'

export function useToastMessage() {
  const toast = useToast()

  const showToast = (message: string, type: ToastType = 'default', duration: number = 3000) => {
    toast.open({
      title: message,
      duration: duration,
      type: type
    })
  }

  return {
    show: showToast,
    success: (message: string, duration?: number) => showToast(message, 'success', duration),
    warning: (message: string, duration?: number) => showToast(message, 'warning', duration),
    error: (message: string, duration?: number) => showToast(message, 'error', duration)
  }
}
